<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商编查询')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="searchForm">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>商户编号：</label>
                                <input type="text" name="bno"/>
                            </li>
                            <li>
                                <label>商户名称：</label>
                                <input type="text" name="note"/>
                            </li>
                            <li>
                                <label>商户状态：</label>
                                <input type="text" name="status"/>
                            </li>
                            <li>
                                <label>费率类型：</label>
                                <input type="text" name="rateType"/>
                            </li>

                            <li>
                                <label>省代码：</label>
                                <input type="text" name="area"/>
                            </li>
                            <li>
                                <label>市代码：</label>
                                <input type="text" name="areas"/>
                            </li>
                            <li>
                                <label>备注2：</label>
                                <input type="text" name="note2"/>
                            </li>
                            <li>
                                <label>优先级：</label>
                                <input type="text" name="localLevel"/>
                            </li>
                            <li>
                                <label >MCC：</label>
                                <input type="text" name="mcc" />
                            </li>
                            <li>
                                <label >BID号段：</label>
                                <input type="text" name="start_sn"   style="width: 120px">-<input type="text" name="end_sn"  style="width: 120px">
                            </li>
                            <li>
                                <label >上限笔数：</label>
                                <input type="text" name="countSerial"/>
                            </li>
                            <li>
                                <label>上限金额：</label>
                                <input type="text" name="sumMoney"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">

                <a class="btn btn-success" onclick="downloadMerchant()" shiro:hasPermission="ReportMerchant:downloadMerchant">
                    <i class="fa fa-download"></i> 商编导出
                </a>
                <a class="btn btn-success" onclick="editMerchant()" shiro:hasPermission="ReportMerchant:editMerchant">
                    <i class="fa fa-edit"></i> 商编信息变更
                </a>
                <a class="btn btn-success single disabled" onclick="transactionDetail()" shiro:hasPermission="ReportMerchant:transactionDetail">
                    <i class="fa fa-edge"></i> 交易详情
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "ReportMerchant";
        var editFlag = [[${@permission.hasPermi('ReportMerchant:ReportMerchant:edit')}]];
        $(function() {
          var options = {
            updateUrl: prefix + "/edit/{id}",
            url: prefix + "/queryMerchantList",
            clickToSelect: true,
            modalName: "商编查询",
            columns: [{
                radio: true
              },
              {
                field: 'tbId',
                title: '渠道编号'
              },
              {
                field: 'bid',
                title: '通道编号'
              },
              {
                field: 'bno',
                title: '渠道商户编号'
              },
              {
                field: 'bankBno',
                title: '渠道真实商户'
              },
              {
                field: 'note',
                title: '商户名称'
              },
              {
                field: 'status',
                title: '状态'
              },
              {
                field: 'bankType',
                title: '通道类型',
                  formatter: function (value, row, index) {
                      if (value == "1") {
                          return '<span style="color:blue;">本行</span>';
                      } else if (value == "2") {
                          return '<span style="color:green;">跨行</span>';
                      }
                  }
              },
              {
                field: 'rateType',
                title: '费率类型',
                  formatter: function (value, row, index) {
                      if (value == "4") {
                          return '<span style="color:blue;">优惠类</span>';
                      } else if (value == "5") {
                          return '<span style="color:green;">标准类</span>';
                      }
                  }
              },
              {
                field: 'localLevel',
                title: '优先级别'
              },
              {
                field: 'standardRate',
                title: '借记卡标准',
                formatter: function (value, row, index) {
                  return $.table.numberFormatter(value, 4);
                }
              },
              {
                field: 'countSerial',
                title: '通道交易上限笔数'
              },
              {
                field: 'nowCountSerial',
                title: '通道当日交易现有笔数'
              },
              {
                field: 'sumMoney',
                title: '通道交易上限金额',
                formatter: function (value, row, index) {
                  return $.table.numberFormatter(value);
                }
              },
              {
                field: 'nowSumMoney',
                title: '通道当日交易现有金额',
                formatter: function (value, row, index) {
                  return $.table.numberFormatter(value);
                }
              },
              {
                field: 'minMoney',
                title: '通道允许的最小金额',
                formatter: function (value, row, index) {
                  return $.table.numberFormatter(value);
                }
              },
              {
                field: 'maxMoney',
                title: '通道允许的最大金额',
                formatter: function (value, row, index) {
                  return $.table.numberFormatter(value);
                }
              },
              {
                field: 'singleRate',
                title: '贷记卡标准',
                formatter: function (value, row, index) {
                  return $.table.numberFormatter(value, 4);
                }
              },
              {
                field: 'supportedCard',
                title: '支持的卡类型',
                  formatter: function (value, row, index) {
                      if (value == "0") {
                          return '<span style="color:blue;">全部支持</span>';
                      } else if (value == "1") {
                          return '<span style="color:green;">仅支持磁条卡</span>';
                      } else if (value == "2") {
                          return '<span style="color:green;">仅支持IC卡</span>';
                      }
                  }
              },
              {
                field: 'singleMoney',
                title: '贷记卡封顶',
                formatter: function (value, row, index) {
                  return $.table.numberFormatter(value);
                }
              },
              {
                field: 'borrowCard',
                title: '支持的借贷记卡',
                  formatter: function (value, row, index) {
                      if (value == "0") {
                          return '<span style="color:blue;">全部支持</span>';
                      } else if (value == "1") {
                          return '<span style="color:green;">仅支持借记卡</span>';
                      } else if (value == "2") {
                          return '<span style="color:green;">仅支持贷记卡</span>';
                      }
                  }
              },
              {
                field: 'standardMoney',
                title: '借记卡封顶',
                formatter: function (value, row, index) {
                  return $.table.numberFormatter(value);
                }
              },
              {
                field: 'isLoad',
                title: '加载状态',
                  formatter: function (value, row, index) {
                      if (value == "0") {
                          return '<span style="color:blue;">未加载</span>';
                      } else if (value == "1") {
                          return '<span style="color:green;">已加载</span>';
                      }
                  }
              },
              {
                field: 'isUser',
                title: '所属商编池'
              },
              {
                field: 'afterH',
                title: '可交易前时间'
              },
              {
                field: 'beforeH',
                title: '可交易后时间'
              },
              {
                field: 'beforeHour',
                title: '可交易前时间'
              },
              {
                field: 'afterHour',
                title: '可交易后时间'
              },
              {
                field: 'isMis',
                title: '是否支持双免',
                  formatter: function (value, row, index) {
                      if (value == "0") {
                          return '<span style="color:blue;">支持</span>';
                      } else if (value == "1") {
                          return '<span style="color:green;">不支持</span>';
                      }
                  }
              },
              {
                field: 'mcc',
                title: '行业码'
              },
              {
                field: 'area',
                title: '省'
              },
              {
                field: 'areaS',
                title: '市'
              },
              {
                field: 'areaQ',
                title: '区'
              },
              {
                field: 'remarks',
                title: '备注(原因)'
              },
            {
                field: 'bnoType',
                title: '特计类商编'
            },
            {
                field: 'isshort',
                title: '是否短商户'
            },
            {
                field: 'note2',
                title: '备注2'
            },
            {
                field: 'is23',
                title: 'IS23'
            },
            {
                title: '操作',
                align: 'center',
                formatter: function(value, row, index) {
                    var actions = [];
                    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.tid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                    return actions.join('');
                }
            }]
          };
            $.table.init(options);
        });


        function downloadMerchant() {
            $.modal.confirm("请检查好导出条件,确认是否导出？", function() {
                $.operate.submit(prefix + "/downloadMerchant", "post", "json", $('#searchForm').serialize());
            });
        }

        function editMerchant() {
          $.modal.open("上传文件资料", prefix + "/editMerchant",650,350);
        }

        function transactionDetail() {
            var bno = $.table.selectColumns('bno');
            if ($.common.isEmpty(bno)) {
                $.modal.alertWarning("请选择一条记录");
                return;
            }
            var url = prefix + "/transactionDetail?bno="+bno;

            var btn = ['关闭'];
            var options = {
                title: '交易详情',
                width: 1500,
                height: 800,
                url: url,
                btn: btn,
                yes:function(index){
                    layer.close(index);
                }
            };
            $.modal.openOptions(options);
        }
    </script>
</body>
</html>